package com.sena.crawler.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * @author seven
 * @create 2021-06-24 9:55
 **/
public enum FileTypeEnums {

    pdf(".pdf", "pdf文件","PDF_LINK"),
    xls(".xls", "Excel 2010 ","XLS_LINK"),
    xlsx(".xlsx", "Excel 2010 ","XLSX_LINK"),
    txt(".txt", "txt文件","TXT_LINK"),
    doc(".doc", "pdf文件","DOC_LINK"),
    docx(".docx", "pdf文件","DOCX_LINK")
    ;

    public static FileTypeEnums getByCodeType(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }

        for (FileTypeEnums result : values()) {
            if (code.equalsIgnoreCase(result.getCode())) {
                return result;
            }
        }

        return null;
    }


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    /**
     * codeType
     */
    private String code = null;

    /**
     * 描述
     */
    private String desc = null;

    private String type;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }


    FileTypeEnums(String code, String desc, String type) {
        this.code = code;
        this.desc = desc;
        this.type = type;
    }
}
